package com.itmuch.usercenter.controller;

import com.itmuch.usercenter.dao.user.UserMapper;
import com.itmuch.usercenter.domain.entity.user.User;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Date;

@RestController
public class Testcontroller {

    @Resource
    private UserMapper userMapper;

    @GetMapping("test")
    public User testInsert(){
    User user = User.builder()
            .avatarUrl("asd")
            .bonus(100)
            .roles("asdasd")
            .createTime(new Date())
            .updateTime(new Date())
            .build();
    System.out.println(user.toString());
    userMapper.insertSelective(user);
        System.out.println(user.toString());
    return user;
  }

   @GetMapping("/q")
    public User query(User user){
        return  user;
   }

}
